package com.atguigu.util;

import java.util.Random;

public class SaltUtils {

    public static String getSalt(int n){
        String s = "QWERTYUIOPASDFGHJKLZXCVBNM" + "QWERTYUIOPASDFGHJKLZXCVBNM".toLowerCase() + "!@#$%^&*(){}";
        char[] chars = s.toCharArray();
        StringBuilder salt=new StringBuilder();

        for (int i = 0; i < n; i++) {
            //nextInt: between zero (inclusive) and {@code bound} (exclusive)
            salt.append(chars[new Random().nextInt(chars.length)]);
        }
        return salt.toString();
    }
}
